package com.gzu.live;

import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @GetMapping("/login")
    String login(@RequestParam String username, HttpSession session) {
        session.setAttribute("username", username);
        return "成功登陆: " + username;
    }

    @GetMapping("/logout")
    String logout(HttpSession session) {
        session.setAttribute("username", null);
        return "成功登出";
    }
}
